package spring.yongongsystem.controller.worker;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import spring.yongongsystem.result.Result;
import spring.yongongsystem.service.WorkerService;

@RestController("workerOrderController")
@RequestMapping("/worker/order")
@Api(tags = "用工订单相关接口")
@Slf4j
public class OrderController {
    @Autowired
    private WorkerService workerService;

    @PostMapping("/accept")
    @ApiOperation("接受订单")
    public Result accept(Long workerId,Long orderId){
        log.info("{} 接受订单 {}",workerId,orderId);
        workerService.accept(workerId,orderId);
        return Result.success();
    }

    @PostMapping("/success")
    @ApiOperation("完成订单")
    public Result success(Long id,String photo){
        log.info("完成订单 {}",id,photo);
        workerService.success(id,photo);
        return Result.success();
    }
}
